limsLocationBoard.boardSimpleDetailPage = {

    getBtnToolbar: function () {
        var _this = this
        return {
            type: 'btnToolbar',
            items: [{
                type: 'button',
                text: 'GIKAM.BUTTON.BACK',
                icon: 'back',
                onClick: function () {
                    workspace.window.goBack()
                }
            },]
        }
    },

    getHoleTab: function () {
        var _this = this;
        return {
            type: 'sampleLocation',
            id: 'sample-Location',
            bgIcon: {
                blood: '/static/lsi/img/location/blood.svg',
                cell: '/static/lsi/img/location/stem-cell.svg',
                dna: '/static/lsi/img/location/dna.svg'
            },
            bgColor: {
                in: 'green',
                out: 'blue',
            },
            rowNum: 0,
            colNum: 0,
            // width: 800,
            // height: 800,
            data: [],
            onClick: function (data) {
                console.log(data);
                let form = Gikam.getComp('location-hole-info-form');
                if (data.sampleId) {
                    form.refresh({
                        url: Gikam.printf(limsLocationBoard.sampleUrl + '/{id}', {
                            id: data.sampleId
                        })
                    });
                } else {
                    form.cleanData();
                }
            },
            onDbclick: function (data) {
            },
            onRendered: function (data) {
                Gikam.postSync(limsLocationBoard.holeUrl + '/queries', Gikam.getJsonWrapper({
                f: {
                    boardId_EQ: _this.param.id
                },
                n: -1, s: -1
            })).done(function (data) {
                if (Gikam.isEmpty(data.rows)) {
                    Gikam.getComp('sample-Location').rowNum = 0;
                } else {
                    Gikam.getComp('sample-Location').setData(data.rows);
                }
            })
            }
        }
    },

    getHoleInformTab: function () {
        var _this = this;
        return {
            id: 'location-hole-info-form',
            type: 'form',
            titleWidthAuto: true,
            readonly: true,
            fields: limsLocationBoard.getHoleDetailInfoFormFields(),
            columns: 3,
        }
    },

    createPage: function () {
        let _this = this
        Gikam.create('layout', {
            center: {
                items: [this.getBtnToolbar(), {
                    type: 'layout',
                    center: {
                        items: [_this.getHoleTab()]
                    },
                    south: {
                        height: 100,
                        title: 'MODULE.BUSINESS.ORDERTASK.TAB.SAMPLE_INFO',
                        items: [_this.getHoleInformTab()]
                    }
                }]
            },
            toolbarAlign: 'right',
            renderTo: workspace.window.$dom
        });
        return this;
    },

    init: function (param) {
        this.param = param;
        this.createPage();
    }
}
